Socket
Socket
Sign inDemoInstall

brotli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

brotli

A port of the Brotli compression algorithm as used in WOFF2


Version published
Weekly downloads
3.2M
increased by2.72%
Maintainers
1
Weekly downloads
 
Created

What is brotli?

The brotli npm package is a compression library that implements the Brotli compression algorithm. It provides methods for compressing and decompressing data using Brotli in Node.js applications.

What are brotli's main functionalities?

Compression

This feature allows you to compress data using the Brotli algorithm. The code sample demonstrates how to read a file, compress its contents, and then write the compressed data to a new file with a .br extension.

const brotli = require('brotli');
const fs = require('fs');

const input = fs.readFileSync('input.txt');
const compressed = brotli.compress(input);
fs.writeFileSync('input.txt.br', compressed);

Decompression

This feature allows you to decompress data that was previously compressed with the Brotli algorithm. The code sample shows how to read a compressed file, decompress its contents, and then write the decompressed data to a new file.

const brotli = require('brotli');
const fs = require('fs');

const compressed = fs.readFileSync('input.txt.br');
const decompressed = brotli.decompress(compressed);
fs.writeFileSync('output.txt', decompressed);

Other packages similar to brotli

Keywords

FAQs

Package last updated on 08 Jun 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc